<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('parent')->comment('该分类的父类ID,取值于该表的id字段');
            $table->string('title')->comment('分类名称');
            $table->tinyInteger('level')->default(1)->comment('分类层级');
            $table->string('desc')->nullable()->comment('分类描述');
            $table->tinyInteger('order')->comment('该分类在页面显示的顺序,数字越大顺序越靠后,同数字,id在前的先显示');
            $table->tinyInteger('if_show')->comment('是否在前台页面显示 1显示; 0不显示');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}
